package redis.inaction.xx.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import redis.inaction.xx.interceptor.UserAndLogInterceptor;

@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {

    @Bean
    public UserAndLogInterceptor userAndLogInterceptor(){
        return new UserAndLogInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(userAndLogInterceptor())
                .addPathPatterns("/**").excludePathPatterns("/login", "");
    }
}
